setTimeout(function() {
    var doc = window.document;
    var beforeopenEvent = false;
    var openEvent = false;
    var beforecloseEvent = false;
    var closeEvent = false;
    var slideout = new Slideout({
        'panel': doc.getElementById('panel'),
        'menu': doc.getElementById('menu'),
        'padding': 350
    });

    slideout
        .on('beforeopen', function() {
            beforeopenEvent = true;
        })
        .on('open', function() {
            openEvent = true;
        })
        .on('beforeclose', function() {
            beforecloseEvent = true;
        })
        .on('close', function() {
            closeEvent = true;
        });

    document.querySelector('.hea-left-icon').addEventListener('click', function() {
        slideout.toggle();
    });

    document.querySelector('.menu').addEventListener('click', function(eve) {
        if (eve.target.nodeName === 'A') {
            slideout.close();
        }
    });
}, 400);